﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessLogic;

namespace SEP.Admin
{
    public partial class ServiceReportAllJobs : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                //postback
            }
            else
            {
                //not a postback
                BindData();
            }
        }

        private void BindData()
        {
            grvJobs.DataSource = new Job().GetAll();
            grvJobs.DataBind();
        }

        protected void grvJobs_OnSelectedIndexChanging(object sender, GridViewSelectEventArgs e)
        {
            string id = grvJobs.DataKeys[e.NewSelectedIndex].Value.ToString();

            Response.Redirect(string.Format("~/Admin/ServiceReportView.aspx?jobID={0}", id));
        }
    }
}